<!--
 * @Author: 杨涛 2749552387@qq.com
 * @Date: 2024-09-11 09:36:58
 * @LastEditors: 杨涛 2749552387@qq.com
 * @LastEditTime: 2024-11-05 11:40:48
 * @FilePath: \vite3\index.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Midas-Insight</title>
    <script>
     //定义UE5()函数
    "object" != typeof ue && (ue = {}),
        (uuidv4 = function() {
            return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function(t) {
                return (t ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (t / 4)))).toString(16);
            });
        }),
        (ue5 = (function(r) 
        {
            return "object" != typeof ue.interface || "function" != typeof ue.interface.broadcast ?
                ((ue.interface = {}),
                    function(t, e, n, o) {
                        var u, i;
                        "string" == typeof t &&
                            ("function" == typeof e && ((o = n), (n = e), (e = null)),
                                (u = [t, "", r(n, o)]),
                                void 0 !== e && (u[1] = e),
                                (i = encodeURIComponent(JSON.stringify(u))),
                                "object" == typeof history && "function" == typeof history.pushState ?
                                (history.pushState({}, "", "#" + i), history.pushState({}, "", "#" + encodeURIComponent("[]"))) :
                                ((document.location.hash = i), (document.location.hash = encodeURIComponent("[]"))));
                    }) :
                ((i = ue.interface),
                    (ue.interface = {}),
                    function(t, e, n, o) {
                        var u;
                        "string" == typeof t &&
                            ("function" == typeof e && ((o = n), (n = e), (e = null)),
                                (u = r(n, o)),
                                void 0 !== e ? i.broadcast(t, JSON.stringify(e), u) : i.broadcast(t, "", u));
                    });
            var i;
        })(function(t, e) {
            if ("function" != typeof t) return "";
            var n = uuidv4();
            return (
                (ue.interface[n] = t),
                setTimeout(function() {
                    delete ue.interface[n];
                }, 1e3 * Math.max(1, parseInt(e) || 0)),
                n
            );
        }));
      window.ue5 = ue5
      ue.interface.showSidebar = (parms) => {
      //函数内部执行操作
      alert("触发了",parms)   
        console.log('~~~~',parms)
        ue5("js2ue","我是杨涛")
      };
      ue.interface.ue4open = function(uedata){
        alert("触发了",uedata)
      }
    </script>
  </head>
  <body>
    <!-- <div style="background-color: blue; width: 200px;height: 200px;color: #ffffff;">当地的经济</div> -->
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
